package com.zy.socket;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;

/**
 * @Author Gong
 * @Description 服务端
 * @dATE 2021/12/16 11:02
 **/
public class Server1 {


    public static void main(String[] args)  {
        ServerSocket serverSocket = null;
        try {
            serverSocket = new ServerSocket(8989);
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            Socket socket = null;
            //服务大厅，不挺运行
            //此处可以监听多个客户端
            while (true){

                socket = serverSocket.accept();
                new Thread(new ThreadServer(socket)).start();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
